package com.wandian.controller
{
	import com.wandian.data.GameData;
	import com.wandian.view.mediator.SetRoomMediator;
	
	import flash.display.MovieClip;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;

	/**
	 * @author long
	 * @Create  2012-10-29 下午05:24:28
	 * @QQ 108232706
	 * @version 1.0
	 */
	public class SetRoomCommand extends SimpleCommand
	{
		private var _global:GameData;
		private var _mcSetRoom:MovieClip;

		public function SetRoomCommand()
		{
			super();
			this._global=GameData.getInstance();
		}

		override public function execute(notification:INotification):void
		{
			super.execute(notification);
			switch (notification.getName())
			{
				case CLZNoticeName.SET_ROOM_WINDOS_SHOW:
				{
					this.showSetRoom(notification);
					break;
				}
				default:
				{
					break;
				}
			}
			return;
		}

		private function showSetRoom(notification:INotification):void
		{
			var data:*=notification.getBody();
			if (!this._mcSetRoom)
			{
				this._mcSetRoom=GameData.getMovieClip("SetRoomPanel");
			}
			if (!Texas.I._mcWindosView.contains(this._mcSetRoom))
			{
				Texas.I._mcWindosView.addChildTo(this._mcSetRoom);
			}
			Texas.I._mcWindosView.centerXY(this._mcSetRoom);
			if (facade.hasMediator(SetRoomMediator.NAME))
			{
				return;
			}
			facade.registerMediator(new SetRoomMediator(this._mcSetRoom, data));
			return;
		}
	}
}
